<template>
	<view class="table-list" v-if="status==1">
		<template v-for="(item, index) in table_list">
			<view class="table">
				<text>{{item}} 号餐桌</text>
				<button size="mini" @click="chooseTable(item)">选择</button>
			</view>
		</template>
	</view>
</template>

<script>
	// import tableModel from '@/api/table.js'
	
	export default {
		data() {
			return {
				table_list: [],
				status:3
			};
		},
		onLoad() {
			let _this=this;
			// this.getBanner();
			uni.request({
				url: 'https://apiorder.wzq0307.com/api/Status/index',
				method: 'GET',
				data: {},
				success: (res) => {
					console.log(11111,res.data.data.status);
					_this.status=res.data.data.status;
						uni.setStorage('status',res.data.data.status);
				},
				fail: function(e) {
					console.log(JSON.stringify(e));
				}
			})
			this.getTableAll();
		},
		methods: {
			getTableAll() {
				this.table_list = ['abc',4,3,'aaa']
				// const _this = this;
				// tableModel.getTableAll().then(res => {
				// 	if(res.status == 200) {
				// 		_this.table_list = res.data;
				// 	}
				// })
			},
			chooseTable(id) {
				// console.log(id)
				uni.setStorageSync('table_num', id);
				uni.navigateBack();
			}
		}
	}
</script>

<style lang="less" scoped>
.table-list .table {
		padding: 20rpx 30rpx;
		background-color: white;
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 20rpx;
	}
.table-list .table button {
			background-color: #CE935B;
			border-radius: 5px;
			color: white;
		}
button{
	box-sizing: border-box;
}
button {
	font-size: 28rpx;
	border-radius: 4rpx;
	margin: 0;
	
	&:after {
		border: 0;
	}
	
	&[type='primary'] {
		background-color: #007aff;
		
		&[plain] {
			background-color: #ffffff;
			border: 2rpx solid #007aff;
			color: #007aff;
		}
		
		&.button-hover {
			background-color: #007aff;
		}
	}
	
	&[type='default'] {
		color: #999 !important;
		border: 2rpx solid #ccc !important;
		background-color: #ffffff;
	}
	
	&[type='info'] {
		background-color: #343434;
		color: #ffffff !important;
		
		&.button-hover, &[disabled] {
			background-color:  #343434;
		}
	}
}
page {
	font-size: 28rpx;
}
</style>
